﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <title>设置隐藏与显示</title>
    <link rel="stylesheet" type="text/css" href="../../../Scripts/easyUI145/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="../../../Scripts/easyUI145/themes/icon.css" />
    <script type="text/javascript" src="../../../Scripts/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="../../../Scripts/easyUI145/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../../../Scripts/easyUI145/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="../../../Scripts/EasyUIUtility.js"></script>
    <script type="text/javascript" src="../../../Scripts/bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../../../Scripts/Cookie.js"></script>
    <script type="text/javascript" src="../../../Scripts/QueryString.js"></script>
    <!--<link href="../Style/CommStyle.css" rel="stylesheet" type="text/css" />-->
    <link href="../../../Scripts/bootstrap/css/bootstrap.css" rel="Stylesheet" />
    <script src="../../JS/Calendar/WdatePicker.js" type="text/javascript"></script>
    <link href="../../JS/Calendar/skin/WdatePicker.css" rel="stylesheet" type="text/css" />
    <!-- 该文件可以被集成厂商自己定义风格,可以自己修改,以达到流程设计器与自己的系统风格统一. -->
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" />
    <!-- 位置必须放在 jquery 之后. -->
    <script type="text/javascript" src="../../../Scripts/QueryString.js"></script>
    <script type="text/javascript" src="../../../Scripts/config.js"></script>
    <script src="../../../Comm/Gener.js"></script>
    <style type="text/css">
        .textbox-addon {
            position: absolute;
        }

        .textbox-text {
            margin: 0px 26px 0px 0px;
            padding-top: 0px;
            padding-bottom: 0px;
            height: 28px !important;
            line-height: 28px !important;
        }

        .style1 {
            width: 326px;
        }
    </style>
    <script type="text/javascript">

        var node;//节点信息
        var Sys_MapAttr;//表单字段
        $(function () {

            var fk_flow = GetQueryString("FK_Flow");
            var fk_node = GetQueryString("FK_Node");
            //查询节点信息
            node = new Entity("BP.WF.Node");
            node.SetPKVal(fk_node);
            node.RetrieveFromDBSources();

            //查询表单字段
            Sys_MapAttr = new Entities("BP.Sys.MapAttrs", "FK_MapData", "ND"+fk_node);
            Fields();//字段查询.

        })

        //字段查询.
        function Fields() {

            var html = "";
            var num = 1;
            html += "<table width='100%'>";
           
            html += "<thead>";
            html += "<tr>";
            html += "<th>序</th>";
            html += "<th>字段名</th>";
            html += "<th>中文名</th>";
            html += "</tr>";
            html += "</thead>";
            html += "<tbody >";
            //遍历字段
            for (var i = 0; i < Sys_MapAttr.length; i++) {
                var mapAttr = Sys_MapAttr[i];
                    if (mapAttr.KeyOfEn == "CDT" ||
                    mapAttr.KeyOfEn == "Emps" ||
                    mapAttr.KeyOfEn == "FID" ||
                    mapAttr.KeyOfEn == "FK_Dept" ||
                    mapAttr.KeyOfEn == "FK_NY" ||
                    mapAttr.KeyOfEn == "MyNum" ||
                    mapAttr.KeyOfEn == "OID" ||
                    mapAttr.KeyOfEn == "RDT" ||
                    mapAttr.KeyOfEn == "Rec") {

                    continue;
                    }
                    html += "<tr>";
                    html += "<td>" + num + "</td>";
                    html += "<td>" + mapAttr.KeyOfEn + "</td>";
                
                    var checked = "";
                    var Keys = node.GetPara("NodeNote");
                        if (Keys != undefined) {
                            var Vals = Keys.split(",");
                            for (var k = 0; k < Vals.length; k++) {
                            if (Vals[k] == mapAttr.KeyOfEn) {
                                checked = " checked=true ";
                            }
                        }
                    }
                       

                    html += "<td><label><input type='checkbox' " + checked + " name='FieldAttr' id='" + mapAttr.KeyOfEn + "' />" + mapAttr.Name + "</label></td>";
                html += "</tr>";
                num++;

            }
                
            html += "</tbody>";
            html += "</table>";
            html += "<input type=button onclick='SaveFields();' value='保存' />";

            $("#docs").html(html);

        }
        //保存字段
        function SaveFields() {

            //获取选中的表单字段.
            var nodeNote = ",";
            $.each($('input:checkbox[name=FieldAttr]:checked'), function (i, obj) {
                nodeNote +=  obj.id + ",";
            });

            node.SetPara("NodeNote",nodeNote);
            node.Update();
            window.location.href = window.location.href;

        }
        

    </script>
</head>
<body class="easyui-layout">
    <div data-options="region:'center'" style="padding:5px;">
        <div id="docs">
        </div>
    </div>
</body>
</html>
